package com.cazor.dg.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cazor.common.utils.DateUtils;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.cazor.dg.mapper.DgDeviceSensorMapper;
import com.cazor.dg.domain.DgDeviceSensor;
import com.cazor.dg.service.IDgDeviceSensorService;

/**
 * 传感器Service业务层处理
 * 
 * @author cazor
 * @date 2023-11-25
 */
@Service
public class DgDeviceSensorServiceImpl extends ServiceImpl<DgDeviceSensorMapper, DgDeviceSensor> implements IDgDeviceSensorService
{
    @Resource
    private DgDeviceSensorMapper dgDeviceSensorMapper;

    /**
     * 查询传感器
     * 
     * @param id 传感器主键
     * @return 传感器
     */
    @Override
    public DgDeviceSensor selectDgDeviceSensorById(Long id)
    {
        return dgDeviceSensorMapper.selectDgDeviceSensorById(id);
    }

    /**
     * 查询传感器列表
     * 
     * @param dgDeviceSensor 传感器
     * @return 传感器
     */
    @Override
    public List<DgDeviceSensor> selectDgDeviceSensorList(DgDeviceSensor dgDeviceSensor)
    {
        return dgDeviceSensorMapper.selectDgDeviceSensorList(dgDeviceSensor);
    }

    /**
     * 新增传感器
     * 
     * @param dgDeviceSensor 传感器
     * @return 结果
     */
    @Override
    public int insertDgDeviceSensor(DgDeviceSensor dgDeviceSensor)
    {
        dgDeviceSensor.setCreateTime(DateUtils.getNowDate());
        return dgDeviceSensorMapper.insertDgDeviceSensor(dgDeviceSensor);
    }

    /**
     * 修改传感器
     * 
     * @param dgDeviceSensor 传感器
     * @return 结果
     */
    @Override
    public int updateDgDeviceSensor(DgDeviceSensor dgDeviceSensor)
    {
        dgDeviceSensor.setUpdateTime(DateUtils.getNowDate());
        return dgDeviceSensorMapper.updateDgDeviceSensor(dgDeviceSensor);
    }

    /**
     * 批量删除传感器
     * 
     * @param ids 需要删除的传感器主键
     * @return 结果
     */
    @Override
    public int deleteDgDeviceSensorByIds(Long[] ids)
    {
        return dgDeviceSensorMapper.deleteDgDeviceSensorByIds(ids);
    }

    /**
     * 删除传感器信息
     * 
     * @param id 传感器主键
     * @return 结果
     */
    @Override
    public int deleteDgDeviceSensorById(Long id)
    {
        return dgDeviceSensorMapper.deleteDgDeviceSensorById(id);
    }
}
